package enemyPackage;

import java.awt.Color;
import java.awt.Graphics;
import java.awt.image.ImageObserver;
import java.util.Random;

import javax.swing.ImageIcon;

import utilPackage.Commons;

public class Alien extends Enemy implements Commons{

    private Bomb bomb;
    protected int alien_score_value = 5; 
    public final String expl = "../Image/expl.gif";
    public final String alienpix1 = "../Image/bad_alien.gif";
    public final String alienpix0 = "../Image/bad_alien2.gif";
    
    
    public Alien() {}
    
    public Alien(int x, int y, int b) {
        this.x = x;
        this.y = y;
        bonus = b;
        bomb = new Bomb(x, y);
        this.health = 1;
        
        ImageIcon ii = new ImageIcon(this.getClass().getResource(this.alienpix1));
		this.setImage(ii.getImage());
    }

    public void act(int direction) {
        this.x += direction;
    }

    public Bomb getBomb() {
        return bomb;
    }

    public int getScoreValue(){
    	return alien_score_value;
    }

    public void draw(Graphics g){
    	if (isVisible()) {
			g.setColor(new Color(255,255,255,(int)(Math.random() * 25)));
			g.fillRoundRect(x+4, y-2, ALIEN_WIDTH-8, 2, 2,2);
			g.setColor(new Color(255,255,255,(int)(Math.random() * 50)));
			g.fillRoundRect(x+1, y-1, ALIEN_WIDTH-2, 2, 2,2);
			g.setColor(new Color(255,255,255,(int)(Math.random() * 50)));
			g.fillRoundRect(x, y, ALIEN_WIDTH, 2, 1,1);
			g.setColor(new Color(255,255,255,(int)(Math.random() * 50)));
			g.fillRoundRect(x, y+1, ALIEN_WIDTH, 1, 1,1);
			g.setColor(new Color(255,255,255, 75));
			g.fillRoundRect(x, y+2, ALIEN_WIDTH, 1, 0,0);
			g.setColor(new Color(0,0,0, 255));
			g.fillRoundRect(x+4, y-4, ALIEN_WIDTH-8, 5, 0,0);
			g.drawImage(getImage(), x, y, (ImageObserver) this);
		
		}
		if (isDying()) {
			die();    	
		}
    }
}

